#!/usr/bin/env python
# -*- coding: UTF-8 -*-
'''
@Project ：图灵学习 
@File    ：4.使用生成器下载静态资源.py
@IDE     ：PyCharm 
@Author  ：ChenLiGao
@Date    ：2024-11-19 15:01
'''
import requests

url = "https://www.baidu.com/img/bd_logo1.png"

response = requests.get(url, stream=True)

with open("4baidu_logo.png", 'ab') as f:
    for chunk in response.iter_content(chunk_size=1024):
        f.write(chunk)

